package 测试类;

import java.util.ArrayList;
import java.util.Scanner;

public class test3 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+1];
		int[] a2 = new int[n+1];

		ArrayList<Integer> b = new ArrayList<>();
		ArrayList<Integer> c = new ArrayList<>();

		for (int i = 1; i < a.length; i++) {
			a[i] = sc.nextInt();
			a2[i] = sc.nextInt();
			if (!b.contains(a[i])) {
				b.add(a[i]);
			}
			if (!c.contains(a2[i])) {
				c.add(a2[i]);
			}
		}
		System.out.println("#Case:"+(b.size()+c.size()));
	}
}
